package com.spica.spicaschool.persistence.dao

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.spica.spicaschool.bean.SportMotionRecord

/**
 * 运动轨迹记录的Dao
 */
@Dao
interface SportMotionRecordDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(entity: SportMotionRecord)

    @Query("SELECT * FROM sportmotionrecord")
    suspend fun queryAll(): List<SportMotionRecord>

    @Query("SELECT * FROM sportmotionrecord")
    fun queryAllLiveData(): LiveData<List<SportMotionRecord>>

    @Query("DELETE FROM sportmotionrecord")
    suspend fun deleteAll()

}